import sys
import os
from PyQt6.QtWidgets import QApplication

# 添加项目根目录到Python路径
current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(current_dir)

try:
    from src.gui.main_window import MainWindow
    from src.utils.config import Config
    from src.utils.logger import setup_logger
except ImportError:
    # 尝试直接导入
    from ai_drawing.src.gui.main_window import MainWindow
    from ai_drawing.src.utils.config import Config
    from ai_drawing.src.utils.logger import setup_logger

def main():
    # 设置日志
    setup_logger()
    
    # 加载配置
    config = Config()
    
    # 创建应用
    app = QApplication(sys.argv)
    
    # 创建主窗口
    window = MainWindow(config)
    window.show()
    
    # 运行应用
    sys.exit(app.exec())

if __name__ == '__main__':
    main()